package com.cooper.controllers.api;

import org.springframework.beans.factory.annotation.Autowired;

import com.cooper.controllers.Controller;
import com.cooper.core.JsonResult;
import com.cooper.service.admin.LocationService;

import net.paoding.rose.web.annotation.Param;
import net.paoding.rose.web.annotation.rest.Get;

public class AreaController extends Controller {
	
	@Autowired
	private LocationService locationService;
	
	@Get
	public Object execute(JsonResult json, @Param("lang") String lang) {
		json.put("dataList", this.locationService.getAllCountryList(lang));
		return json;
	}
	
	@Get("{areaId:[0-9]+}")
	public Object getArea(JsonResult json,@Param("areaId") long areaId, @Param("lang") String lang) {
		json.put("dataList", this.locationService.getChildLocationList(areaId, lang));
		return json;
	}

}
